package com.ysd.zytj.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.zytj.model.ConsumeLog;
import com.ysd.zytj.service.IConsumeLogService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/consume")
@Api(tags = "模拟刷卡")
public class ConsumeLogController {

	@Resource
	private IConsumeLogService consumeLogService;
	
	@ApiOperation(value = "刷卡",notes = "刷卡")
	@PostMapping()
	public String swipe(ConsumeLog c) {
		String res = "success";
		if(c.getReadRoomId()>0) {
			res = consumeLogService.in(c);
		}else {
			res = consumeLogService.out(c);
		}
		 
		return res;
	}
}
